package com.eudon.design_pattern.behavioral.iterator;

import java.util.Collection;
import java.util.List;

/**
 * @author eudon
 * @description List简易迭代器
 * @date 2025/9/3
 * @email syd19970616@gmail.com
 * @address <a href="https://gitee.com/eudon">Gitee</a>
 */
public class ListIterator<E> implements Iterator<E> {
    private final List<E> list;
    private int index;
    private E current;
    public ListIterator(List<E> list){
        this.list = list;
        index = 0;
    }
    @Override
    public boolean hasNext() {
        return index < list.size();
    }

    @Override
    public E next() {
        return list.get(index++);

    }
}
